#include "StdAfx.h"
#include "SGImageScanline.h"


SGImageScanline::SGImageScanline(void)
:m_offset( 0 ),
 m_length( 0 )
{
	m_bytes = NULL;
}

SGImageScanline::SGImageScanline( const int offset, const int length )
:m_offset( offset ),
 m_length( length )
{
	m_bytes = new unsigned char[ m_length ];
}

SGImageScanline::SGImageScanline( const SGImageScanline &r )
{
	if( *this != r )
	{
		m_offset = r.m_offset;
		m_length = r.m_length;
		m_bytes = r.m_bytes;
	}
}

SGImageScanline::SGImageScanline( const SGImageScanline *p )
{
	if( *this != *p )
	{
		m_offset = p->m_offset;
		m_length = p->m_length;
		m_bytes = p->m_bytes;
	}
}

SGImageScanline::~SGImageScanline(void)
{
	if( m_bytes )
		delete m_bytes;
}

bool SGImageScanline::operator != ( const SGImageScanline &r )
{
	return ( m_offset != r.m_offset || m_length != r.m_length );
}

bool SGImageScanline::operator == ( const SGImageScanline &r )
{
	return ( m_offset == r.m_offset && m_length == r.m_length );
}

int SGImageScanline::getOffset( void ) const
{
	return m_offset;
}

int SGImageScanline::getLength( void ) const
{
	return m_length;
}

unsigned char* SGImageScanline::getBytes( void ) const
{
	return m_bytes;
}

void SGImageScanline::setBytes( unsigned char *bytes )
{
	for( int i = 0; i < m_length; i++ )
		m_bytes[i] = bytes[i];
	int a = 0;
}